Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scheduler: Replace the input parameter of AddScheduler with types.CheckerSchedulerType. #8416

Merged
merged 7 commits into from
Jul 25, 2024

Conversation

okJiang
Copy link
Member

@okJiang okJiang commented Jul 18, 2024

What problem does this PR solve?

Issue Number: Ref #8379

What is changed and how does it work?

1. Replace the input parameter of AddScheduler with types.CheckerSchedulerType.
2. Simplified the logic of AddScheduler by using a temporary map.
3. Remove scope's redundant definition and use types.CheckerSchedulerType.

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Code changes

Side effects

  • Possible performance regression
  • Increased code complexity
  • Breaking backward compatibility

Related changes

Release note

None.

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. dco-signoff: yes Indicates the PR's author has signed the dco. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Jul 18, 2024
Signed-off-by: okJiang <[email protected]>
@okJiang okJiang marked this pull request as draft July 18, 2024 07:18
@ti-chi-bot ti-chi-bot bot added the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 18, 2024
Signed-off-by: okJiang <[email protected]>
Signed-off-by: okJiang <[email protected]>
Copy link

codecov bot commented Jul 18, 2024

Codecov Report

Attention: Patch coverage is 88.23529% with 4 lines in your changes missing coverage. Please review.

Project coverage is 77.32%. Comparing base (1f14057) to head (e2935c7).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #8416      +/-   ##
==========================================
- Coverage   77.35%   77.32%   -0.04%     
==========================================
  Files         472      472              
  Lines       61903    61807      -96     
==========================================
- Hits        47885    47790      -95     
- Misses      10428    10448      +20     
+ Partials     3590     3569      -21     
Flag Coverage Δ
unittests 77.32% <88.23%> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@okJiang okJiang marked this pull request as ready for review July 18, 2024 10:02
@ti-chi-bot ti-chi-bot bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jul 18, 2024
@@ -70,3 +70,46 @@ const (
// LabelScheduler is label scheduler name.
LabelScheduler CheckerSchedulerType = "label-scheduler"
)

// SchedulerTypeCompatibleMap temporarily exists for compatibility.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suggest adding more explanation about when we need to consider the compatibility.

Copy link
Member Author

@okJiang okJiang Jul 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think there is a need to explain in the code now. Its current role is only to do a layer of conversion when the user adds a scheduler. If it is used in more places in the future, or permanently exists in the code, I will add a more accurate description to it. How about this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ping @rleungx

Copy link
Member

@rleungx rleungx Jul 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am just wondering when we need to consider the compatibility.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is an intermediate pr, it may be deleted in the subsequent pr, if it stays, I will add more comments

@ti-chi-bot ti-chi-bot bot added needs-1-more-lgtm Indicates a PR needs 1 more LGTM. approved labels Jul 23, 2024
@@ -186,7 +185,8 @@ func (h *Handler) GetAllRequestHistoryHotRegion(request *HistoryHotRegionsReques
}

// AddScheduler adds a scheduler.
func (h *Handler) AddScheduler(name string, args ...string) error {
func (h *Handler) AddScheduler(tp types.CheckerSchedulerType, args ...string) error {
name := types.SchedulerTypeCompatibleMap[tp]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line may be removed in the subsequent pr.

@okJiang
Copy link
Member Author

okJiang commented Jul 23, 2024

Could you take a look? @HuSharp @JmPotato

Copy link
Member

@HuSharp HuSharp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

rest LGTM

server/api/scheduler.go Outdated Show resolved Hide resolved
Signed-off-by: okJiang <[email protected]>
@ti-chi-bot ti-chi-bot bot added the lgtm label Jul 25, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 25, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: HuSharp, rleungx

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot removed the needs-1-more-lgtm Indicates a PR needs 1 more LGTM. label Jul 25, 2024
Copy link
Contributor

ti-chi-bot bot commented Jul 25, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-07-23 08:08:23.956983867 +0000 UTC m=+946125.947925338: ☑️ agreed by rleungx.
  • 2024-07-25 03:00:43.13113123 +0000 UTC m=+1100465.122072701: ☑️ agreed by HuSharp.

Copy link
Contributor

ti-chi-bot bot commented Jul 25, 2024

@okJiang: Your PR was out of date, I have automatically updated it for you.

If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository.

@ti-chi-bot ti-chi-bot bot merged commit e8c05e0 into tikv:master Jul 25, 2024
25 checks passed
@okJiang okJiang deleted the name3-1 branch July 25, 2024 03:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved dco-signoff: yes Indicates the PR's author has signed the dco. lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants